﻿using GalaSoft.MvvmLight;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VolunteerManager.Model;

namespace VolunteerManager.ViewModel
{
    /// <summary>
    /// 提供大量的基础数据
    /// </summary>
    public class CommonDataSource:ViewModelBase
    {
        /// <summary>
        /// 群组数据
        /// </summary>
        public List<Group> GroupDataSource { get; set; }

        /// <summary>
        /// 活动项目
        /// </summary>
        public List<ProgramType> ProgramTypeDataSource { get; set; }

        public List<Point> PointDataSource { get; set; }

        public CommonDataSource(IDataService dataService)
        {
            if (IsInDesignMode)
            {
                GroupDataSource = new List<Group>() { new Group() { ID = -1, Name = "群1" } };
                ProgramTypeDataSource = new List<ProgramType>() { new ProgramType() { ID = -1, Name = "活动内容噢" } };
            }
            else {
                GroupDataSource = new Group().FindAll2<Group>("1=1");
                PointDataSource = new Point().FindAll2<Point>("1=1");
                ProgramTypeDataSource = new ProgramType().FindAll2<ProgramType>("1=1");
                this.RaisePropertyChanged("GroupDataSource");
                this.RaisePropertyChanged("PointDataSource");
            }
        }
    }
}
